//
//  ImagePreviewBrowser.h
//  etionUI
//
//  Created by wangjian on 5/10/13.
//
//

#import <UIKit/UIKit.h>

#define IPB_IMAGE_MARGIN 10.0f

@class CImagePreviewBrowser;
@protocol CImagePreviewBrowserDelegate <NSObject>

@required
- (NSInteger)numberOfImagesInimagePreviewBrowser:(CImagePreviewBrowser *)imagePreviewBrowser;
- (id)imagePreviewBrowser:(CImagePreviewBrowser *)imagePreviewBrowser sourceAtIndex:(NSInteger)index;

@optional
- (void)imagePreviewBrowser:(CImagePreviewBrowser *)imageBrowser clickImageAt:(NSInteger)index;
- (void)imagePreviewBrowser:(CImagePreviewBrowser *)imageBrowser scrollTo:(NSInteger)index;

- (UIView *)imagePreviewBrowserAttachedView:(CImagePreviewBrowser *)imageBrowser;
- (void)imagePreviewBrowserAttachedViewClicked:(CImagePreviewBrowser *)imageBrowser;

@end

@interface CImagePreviewBrowser : UIView <UIScrollViewDelegate>
{
    UIScrollView *m_scrollView;
    NSMutableArray *m_arImageViews;
    
    id<CImagePreviewBrowserDelegate> m_delegate;
    
    CGSize m_imageSize;
    UIView *m_attachedView;
    UIView *m_tipsView;
}

@property (nonatomic, assign) id<CImagePreviewBrowserDelegate> m_delegate;

+ (CGFloat)heightForWidth:(CGFloat)width;

- (NSInteger)numberOfImageViews;
- (NSInteger)firstImageViewIndex;

- (void)reloadImages;                           //重新装载数据
- (void)reloadImageAtIndex:(NSInteger)index;    //更新指定图片

- (void)moveToIndex:(NSInteger)index;
- (void)insertImageAtIndex:(NSInteger)index;
- (void)deleteImageAtIndex:(NSInteger)index;

- (void)addAttachedView;
- (void)deleteAttachedView;
- (UIView *)cellViewAtIndex:(NSUInteger)index;

@end
